package com.ruoyi.performance.utils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author YL
 * @date 2020/8/28 11:07
 * @description 判定两个集合是否元素完全相同，对顺序无要求
 */
public class CompareArray {

    public static List<String> compareArray(List<String> lists){
        AtomicInteger count= new AtomicInteger(0);
        //创建一个字母集合
        String[] alphabetArray={"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
        List<String> alphabetList = new ArrayList<>(Arrays.asList(alphabetArray));
        //输入的集合尺寸
        int size = lists.size();
        //从元素A开始长度为size的新字母集合
        List<String> rules=alphabetList.subList(0,size);
        //如果输入的集合与标准字母集合有不同，返回false
        for (String rule:rules){
            for (String list:lists){
                if (list.equals(rule)) {
                    count.getAndIncrement();
                    break;
                }
            }
        }
        if (count.get()!=size){
            return null;
        }
        return rules;
    }
    //先判定等级区间是否正确，再判定上限下限是否0-100，最后判断每个等级分数是否衔接
}
